﻿/*-------------------------------------------------------------------------
* 命名空间: MyToDo.ViewModels/IndexViewModel
* 类       名: IndexViewModel
* 功      能:  TD
* 时      间:  2023/12/14 11:31:34
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using MyToDo.Models;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyToDo.ViewModels
{
    public class IndexViewModel : BindableBase
    {

        public IndexViewModel()
        {
            TaskBars = new ObservableCollection<TaskBar>();
            InitTaskBars();

            ToDoList = new ObservableCollection<ToDoEntity>();
            InitToDoList();

            MemoList = new ObservableCollection<MemoEntity>();
            InitMemoList();
        }

        private void InitMemoList()
        {
            for (int i = 1; i < 11; i++)
            {
                MemoList.Add(new MemoEntity() { Id = i, Title = "备忘" + i, Content = "我的密码" });
            }
        }

        private void InitToDoList()
        {
            for (int i = 1; i < 11; i++)
            {
                ToDoList.Add(new ToDoEntity() { Id = i, Title = "待办" + i, Content = "正在处理中...." });
            }
        }

        private void InitTaskBars()
        {
            TaskBars!.Add(new TaskBar() { Icon = "ClockFast", Title = "汇总", Content = "9", BackgroundColor = "#0097FF" });
            TaskBars!.Add(new TaskBar() { Icon = "ClockCheckOutline", Title = "已完成", Content = "8", BackgroundColor = "#0EB238" });
            TaskBars!.Add(new TaskBar() { Icon = "PercentOutline", Title = "完成比例", Content = "89%", BackgroundColor = "#00B4DD" });
            TaskBars!.Add(new TaskBar() { Icon = "NotebookHeartOutline", Title = "备忘录", Content = "4", BackgroundColor = "#FF9F00" });
        }


        /// <summary>
        /// 备忘录实例类
        /// </summary>
        private ObservableCollection<MemoEntity> memoList = null!;

        public ObservableCollection<MemoEntity> MemoList
        {
            get { return memoList; }
            set
            {
                memoList = value;
                RaisePropertyChanged();
            }
        }



        /// <summary>
        /// 待办事项集合
        /// </summary>
        private ObservableCollection<ToDoEntity> toDoList = null!;

        public ObservableCollection<ToDoEntity> ToDoList
        {
            get { return toDoList; }
            set
            {
                toDoList = value;
                RaisePropertyChanged();
            }
        }



        private ObservableCollection<TaskBar>? taskBars;

        public ObservableCollection<TaskBar>? TaskBars
        {
            get { return taskBars; }
            set
            {
                taskBars = value;
                RaisePropertyChanged();
            }
        }

    }
}
